﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace dungeon_brawler.classes
{
   


    public abstract class Player : Entity
    {
        int expToLvl;
        int exp;

        public Player(int lvl, Vector2 position, Texture2D texture)
            : base(lvl, position, texture)
        {
            // Set exp required for player to lvl
            expToLvl = 10 * lvl;
            exp = 0;
        }

        public override void Update(GameTime gameTime, Rectangle clientBounds)
        {
            // rset direction
            //direction = Vector2.Zero;
            isAtk = false;
            // Move the sprite according to the direction property
            if (Keyboard.GetState().IsKeyDown(Keys.Left))
            {
                direction = Vector2.Zero;
                position.X += direction.X = -spd;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Right))
            {
                direction = Vector2.Zero;
                position.X += direction.X = spd;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Up))
            {
                direction = Vector2.Zero;
                position.Y += direction.Y = -spd;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Down))
            {
                direction = Vector2.Zero;
                position.Y += direction.Y = spd;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Space))
            {
                // Player is now attacking - add cooldown stats to this laters
                IsAtk = true;
            }
            base.Update(gameTime, clientBounds);

        }


        /// <summary>
        /// Returns class stats
        /// </summary>
        /// <returns>String</returns>
        public override String ToString()
        {
            return base.ToString() +
                "\nEXP    " + exp + "         Lvlup " + expToLvl;
        }
    }
}
